package com.zyj.jetpackdemo.moudle

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.Composable
import com.zyj.jetpackdemo.*

class ComposeListsActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            when (intent.getIntExtra(INTENT_DATA, 0)) {
                0 -> ShowListsCompose(this)
                1 -> ShowGraphicsList(this)
            }
        }
    }
}

@Composable
fun ShowListsCompose(activity: Activity) {
    val intent = Intent(activity, ComposeDetailActivity::class.java)
    intent.putExtra(INTENT_DETAIL_TYPE, DetailType.TYPE_LISTS)
    MenuLists(items = columnItems, intent, activity)
}


@Composable
fun ShowGraphicsList(activity: Activity) {
    val intent = Intent(activity, ComposeDetailActivity::class.java)
    intent.putExtra(INTENT_DETAIL_TYPE, DetailType.TYPE_GRAPHIC)
    MenuLists(graphicItems, intent, activity)
}